From 2421e641f42dfb523cb5189ddb812e9cfb8865aa Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 30 Aug 2009 11:14:40 -0400 Subject: [PATCH] Warn when a parent is destroyed Previously gdk_window_new would silently return NULL. Bug 590921. --- gdk/gdkwindow.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index ec9aa56233..3acf0ff4af 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -913,23 +913,26 @@ recompute_visible_regions_internal (GdkWindowObject *private, if (gdk_region_empty (private->clip_region)) visibility = GDK_VISIBILITY_FULLY_OBSCURED; - else { - if (private->shape) - fully_visible = gdk_region_equal (private->clip_region, - private->shape); - else - { - r.x = 0; - r.y = 0; - r.width = private->width; - r.height = private->height; - fully_visible = gdk_region_rect_equal (private->clip_region, &r); - } - - if (fully_visible) - visibility = GDK_VISIBILITY_UNOBSCURED; - else - visibility = GDK_VISIBILITY_PARTIAL; + else + { + if (private->shape) + { + fully_visible = gdk_region_equal (private->clip_region, + private->shape); + } + else + { + r.x = 0; + r.y = 0; + r.width = private->width; + r.height = private->height; + fully_visible = gdk_region_rect_equal (private->clip_region, &r); + } + + if (fully_visible) + visibility = GDK_VISIBILITY_UNOBSCURED; + else + visibility = GDK_VISIBILITY_PARTIAL; } if (private->visibility != visibility) @@ -1194,7 +1197,10 @@ gdk_window_new (GdkWindow *parent, g_return_val_if_fail (GDK_IS_WINDOW (parent), NULL); if (GDK_WINDOW_DESTROYED (parent)) - return NULL; + { + g_warning ("gdk_window_new(): parent is destroyed\n"); + return NULL; + } if (attributes->window_type == GDK_WINDOW_OFFSCREEN && _gdk_native_windows) -- 2.30.2